package com.yindian.cos.easy.security.smsCode;

import com.yindian.cos.easy.security.entity.User;
import com.yindian.cos.easy.security.authentication.login.UserDetail;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 短信验证码登录
 *
 * @author zhangchuanhao
 * @create 2018/11/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CustomSmsCodeUserDetail extends UserDetail {

    private User user;

    public CustomSmsCodeUserDetail(User user) {
        this.user = user;
    }

    @Override
    public String getUserId() {
        return String.valueOf(user.getUserId());
    }

    @Override
    public boolean match() {
        return true;
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
